<include file="Public/min-header" />
<div class="wrapper">
    <include file="Public/breadcrumb" />
    <section class="content">
        <div class="container-fluid">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i>用户列表</h3>
                </div>
                <div class="panel-body">
                    <div class="navbar navbar-default">
                        <form action="" id="search-form2" class="navbar-form form-inline" method="post" onsubmit="return false">
                            <div class="form-group">
                                <label class="control-label" for="input-user_id">会员id</label>
                                <div class="input-group">
                                    <input type="text" name="user_id" value="" placeholder="会员id" id="input-user_id" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label" for="input-nickname">姓名</label>
                                <div class="input-group">
                                    <input type="text" name="nickname" value="" placeholder="姓名" id="input-nickname" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <input type="hidden" name="nid" value="{$nid}">
                                <input type="hidden" name="sort" value="desc">
                                <button type="submit" onclick="ajaxGetTable('search-form2', 1)" id="button-filter search-order" class="btn btn-primary pull-right"><i class="fa fa-search"></i> 筛选</button>
                            </div>
                            <a href="{:U('User/addUser')}" class="btn btn-info pull-right">添加会员</a>
                        </form>
                    </div>
                    <div id="ajax_return">
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
<script>
    $(document).ready(function () {
        ajaxGetTable('search-form2', 1);
    });
// ajax 抓取页面
    function ajaxGetTable(tab, page) {
        cur_page = page; //当前页面 保存为全局变量
        $.ajax({
            type: "POST",
            url: "/index.php/Admin/News/ajaxUser/p/" + page,
            data: $('#' + tab).serialize(),
            success: function (data) {
                $("#ajax_return").html('');
                $("#ajax_return").append(data);
            }
        });
    }
// 点击排序
    function sort(field) {
        $("input[name='order_by']").val(field);
        var v = $("input[name='sort']").val() == 'desc' ? 'asc' : 'desc';
        $("input[name='sort']").val(v);
        ajaxGetTable('search-form2', cur_page);
    }
</script>
</body>
</html>
